package zuoye;

import java.util.Scanner;

public class ArrayDemo2 {
	/*数组查找操作：定义一个长度为10 的一维字符串数组，在每一个元素存放一个单词；
	然后运行时从命令行输入一个单词，程序判断数组是否包含有这个单词，
	包含这个单词就打印出“Yes”，不包含就打印出“No”。*/
	public static void main(String[] args) {
		String[] work= {"word","hello","one","yes","love","age","two","apple","you","yellow"};
		boolean flag=false;
		System.out.println("请输入一个单词：");
		Scanner sc=new Scanner(System.in);
		String word=sc.next();
		for (int i = 0; i < work.length; i++) {
			if(word.equals(work[i])) {
				flag=true;
				break;
			}
		}
		if(flag) {
			System.out.println("yes!");
		}else {
			System.out.println("no!");
		}
	}

}
